package net.zjitc.object.car;

import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/3/19 16:30
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("请选择你要开哪辆车？");
        System.out.println("1--BMW\n2--QQ");
        Scanner scanner=new Scanner(System.in);
        int choose=scanner.nextInt();

//      若 getCar()方法是静态方法，可以类名访问
//        Car car=CarFactory.getCar(choose);

        CarFactory cf=new CarFactory();
        Car car=cf.getCar(choose);
        car.run();


        /*Car car;
        if(choose==1){
            car=new BMW();
        }else if(choose==2){
            car=new QQ();
        }else{
            car=new Car();
        }
        car.run();*/

        /*if(choose==1){
            BMW bmw=new BMW();
            bmw.run();
        }else{
            QQ qq=new QQ();
            qq.run();
        }*/
    }
}
